from selenium.webdriver.common.by import By


class AdminTeamTicketLocator:
    # 右上角的ticket按钮
    tickets_button = (By.XPATH,'/html/body/div[1]/section/div/div/div/div/div[2]/div[2]/span')
    tickets_button2 = (By.XPATH, '(//span[contains(@class,"antd4-dropdown-trigger")])[1]')
    #右上角的team ticket按钮
    team_ticket_button = (By.XPATH,'/html/body/div[3]/div/div/ul/li[1]/span/a')
    # Approval菜单
    approval_tab = (By.XPATH, "//div[contains(@data-menu-id,'APPROVAL')]")
    # Ticket菜单
    ticket_tab = (By.XPATH, "//div[contains(@data-menu-id,'TICKET')]")

    # Team ticket菜单
    team_ticket_tab = (By.CSS_SELECTOR, '[path="/console/tickets/teamTicket"]')

    #菜单滚动条
    menu_scroll = (By.XPATH,'/html/body/div[1]/section/section/aside/div/div[2]')

    # 管理员端右上角头像
    admin_avatar = (By.XPATH, '//div[contains(@class,"avatars___3yniS")]')

    # 管理员端头像下拉框-ticket管理员在线开关
    ticket_admin_online_switch = (By.CSS_SELECTOR, '[role="switch"]')

    #工单管理员在线状态
    ticket_admin_online_status = (By.XPATH, '//span[contains(@class,"antd4-switch-inner")]')

    #以下仅针对第一条记录
    #team ticket页面 View按钮
    team_ticket_view_button = (By.XPATH, '(//button[contains(@class,"antd4-btn-link")])[1]')
    # team ticket页面 Assign按钮
    team_ticket_assign_button = (By.XPATH, '(//button[contains(@class,"antd4-btn-link")])[2]')
    # team ticket页面 Trannsfer按钮
    team_ticket_transfer_button = (By.XPATH, '(//button[contains(@class,"antd4-btn-link")])[3]')
    #ticket_id
    team_ticket_last_id = (By.XPATH,'(//a[contains(@target,"_blank")])[1]')
    search_ticket_last_id = (By.CSS_SELECTOR,'[target="_blank"]')
    search_ticket_status = (By.XPATH,'(//*[@class="antd4-badge-status-text"])[2]')
    search_ticket_priority = (By.XPATH,'(//div[contains(@class,"level-2")])[1]')



    #team ticket页面搜索框
    search_box = (By.ID,'keywords')
    #team ticket页面搜索按钮
    search_button = (By.XPATH, '//button[contains(@class,"antd4-input-search-button")]')

    #Assign页面 support member选择框
    support_member_list = (By.ID,"userCode")

    #Assign页面 support member选择超管
    support_member_selector = (By.CSS_SELECTOR, '[style="background: rgb(56, 158, 13);"]')
    #Assign页面 备注输入框
    assign_remark = (By.ID,'remarks')

    #Assign确认按钮
    assign_confirm_buttton = (By.XPATH,'(//button[contains(@class,"antd4-btn-primary")])[2]')

    #工单详情页，Tickets No
    ticket_id_in_detail_page = (By.XPATH,'/html/body/div[1]/section/main/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/table/tbody/tr[1]/td[1]/div/span[2]/div/span')

    #表格筛选框
    #ticket_status
    ticket_status_filter = (By.XPATH,'(//span[contains(@class,"antd4-table-filter-trigger")])[2]')
    #工单状态的选择框
    pending_for_service = (By.XPATH,'(//label[contains(@class,"antd4-checkbox-wrapper")])[1]')
    solving = (By.XPATH,'(//label[contains(@class,"antd4-checkbox-wrapper")])[2]')
    solved = (By.XPATH,'(//label[contains(@class,"antd4-checkbox-wrapper")])[3]')
    closed = (By.XPATH,'(//label[contains(@class,"antd4-checkbox-wrapper")])[4]')
    reset = (By.CSS_SELECTOR,'[class="antd4-btn antd4-btn-link antd4-btn-sm"]')
    ok = (By.CSS_SELECTOR,'[class="antd4-btn antd4-btn-primary antd4-btn-sm"]')

    #左侧菜单，Team Ticket旁边的pending标签
    team_ticket_menu_pending = (By.XPATH,'//li[contains(@path,"/console/tickets/teamTicket")]/span/div/span[2]')
    #右上角的pending
    team_ticket_pending = (By.XPATH,'(//span[contains(@class,"antd4-tag-has-color")])[1]')

    modify_button = (By.XPATH,'(//button[contains(@class,"antd4-btn-default")])[1]')
    modify_button_confirm = (By.XPATH, '(//button[contains(@class,"antd4-btn-primary")])[3]')

    #修改优先级的选择框
    priority_level = (By.XPATH,'//div[contains(@class,"antd4-select-selector")]')
    priority_level_high = (By.CSS_SELECTOR, '[title="High"]')

    #role页面，收起菜单权限
    approval_menu = (By.XPATH,'(//span[contains(@class,"anticon-minus-square")])[1]')
    dashboard_menu = (By.XPATH,'(//span[contains(@class,"anticon-minus-square")])[2]')
    platform_user_menu = (By.XPATH,'(//span[contains(@class,"anticon-minus-square")])[3]')
    personal_user_menu = (By.XPATH,'(//span[contains(@class,"anticon-minus-square")])[4]')
    enterprise_user_menu = (By.XPATH,'(//span[contains(@class,"anticon-minus-square")])[5]')
    bussiness_user_menu = (By.XPATH,'(//span[contains(@class,"anticon-minus-square")])[6]')
    reseller_user_menu = (By.XPATH,'(//span[contains(@class,"anticon-minus-square")])[7]')

    #工单标签
    ticket_tag = (By.XPATH,'//button[contains(@class,"antd4-btn-round")]/span')

    #team ticket 编辑权限按钮
    team_ticket_auth_edit = (By.XPATH,'(//i[contains(@class,"anticon-edit")])[1]')

    #展开权限按钮
    def get_expand_button(self,number):
        expand_button = (By.XPATH,'(//span[contains(@class,"anticon-plus-square")])['+str(number)+']')
        return expand_button

    def get_auth_name(self,number):
        result = (By.XPATH,'(//span[contains(@class,"antd4-tree-title")])['+str(number)+']')
        return result

    #权限按钮
    assign_auth = (By.XPATH,'(//label[contains(@class,"antd4-checkbox-wrapper")])[4]/span[2]')
    transfer_auth = (By.XPATH, '(//label[contains(@class,"antd4-checkbox-wrapper")])[5]/span[2]')
    solve_auth = (By.XPATH, '(//label[contains(@class,"antd4-checkbox-wrapper")])[6]/span[2]')
    view_auth = (By.XPATH, '(//label[contains(@class,"antd4-checkbox-wrapper")])[7]/span[2]')